$(function () {
    initSwiper()
    const loginController=new LoginController()
    new NavigationController()

    function initSwiper() {
        return new Swiper('.index_swiper_container', {
            autoplay: {
                delay: 3000,
                stopOnLastSlide: false,
                disableOnInteraction: true,
            },//可选选项，自动滑动
            loop : true,
        })
    }

    function NavigationController() {
        //this.NavFragment=document.getElementById('nav_fragment')
        document.getElementById('openLoginFragment').addEventListener('click',function () {
            loginController.switchState('flex')
        })
    }
    
    function LoginController() {
        this.loginFragment=document.getElementById('login_container')
        this.loginFragment.addEventListener('click',()=>{
            this.switchState('none')
        })
        document.getElementById('login_flex').addEventListener('click',function (event) {
            event.stopPropagation()
        })
        this.switchState=(state)=>{
            this.loginFragment.style.display=state
            if (state=='flex'){
                this.loginFragment.classList.add('animate__fadeInDown')
            }else{
                this.loginFragment.classList.remove('animate__fadeInDown')
            }
            //this.loginFragment.style.display=state
        }
    }
})